<?php

namespace App\Http\Controllers\Home;


use App\Model\NewsModel;
use App\Model\NoticeModel;
use App\Model\OtherModel;
use Illuminate\Support\Facades\Input;

class IndexController extends CommonController
{
    //
    public function index()
    {
        $navigate =  $this->navegate;
        $notice = NoticeModel::orderBy('create_time','desc')->limit(10)->get();
        $tuiguang = NewsModel::limit(9)->get();
        return view('home.index.index',compact('navigate','notice','tuiguang'));
    }


    public function about()
    {
        $navigate =  $this->navegate;
        $hot = NewsModel::where('type',3)->orderBy('create_time','desc')->limit(10)->get();
        return view('home.index.about',compact('navigate','hot'));
    }

    public function talent()
    {
        $navigate =  $this->navegate;
        $hot = NewsModel::where('type',3)->orderBy('create_time','desc')->limit(10)->get();
        $talent = OtherModel::where('item_type',2)->limit(10)->get();
        $item_id = Input::get('item_id');
        $item_content = '';
        if($item_id){
         $item_content = OtherModel::select('item_content')->find($item_id)->item_content;
        }
        return view('home.index.talent',compact('navigate','notice','hot','talent','item_content'));
    }

    public function connect()
    {
        $navigate =  $this->navegate;
        $hot = NewsModel::where('type',3)->orderBy('create_time','desc')->limit(10)->get();
        return view('home.index.connect',compact('navigate','notice','hot'));
    }

    public function help()
    {
        $navigate =  $this->navegate;
        $hot = NewsModel::where('type',3)->orderBy('create_time','desc')->limit(10)->get();
        return view('home.index.help',compact('navigate','notice','hot'));
    }

}
